package com.serviceImpl;

import java.util.List;

import com.bean.Craft;
import com.bean.ProcureProduct;
import com.bean.ProcureProductCraft;
import com.bean.ProductPart;
import com.dao.ProcureProductDao;

public class ProcureProductServiceImpl {

	
	private ProcureProductDao procurepdao;

	public ProcureProductDao getProcurepdao() {
		return procurepdao;
	}

	public void setProcurepdao(ProcureProductDao procurepdao) {
		this.procurepdao = procurepdao;
	}

	public List<ProcureProduct> getAllProcurep(String table,String pk,String sort,int PageNumber,int PageSize ,String options){
		
		return procurepdao.getFindProcurep(table, pk, sort, PageNumber, PageSize, options);
	}
	
	/**
	 * 根据需求表id获取当前条需求信息
	 * @param procId
	 * @return
	 */
	public ProcureProduct getById(Integer procId){
	 
		return procurepdao.findById(procId);
	 }
	
	/**
	 * 根据procId查询部位
	 */
	public List<ProductPart> getpBypartId(Integer partId){
		
		return procurepdao.getProcurePList(partId);
	}
	
	public List<Craft> getpBycraftId(Integer craftId){
		
		List<Craft> list=procurepdao.getCraftList(craftId);
		
		return list;
	}
	
	
	/**
	 * 保存采购需求
	 */
	public boolean addProductPart(ProcureProduct procureProduct , StringBuffer testDetailStrs){
			
		procurepdao.saveProductPart(procureProduct,testDetailStrs);
		
		return true;
	}
	
	/**
	 * 删除采购需求
	 */
	public boolean delProcurep(Integer procId){
		
		procurepdao.deleteProcureProduct(procId);
		
		return true;
	}
	
	/**
	 * 采购需求发布
	 */
	public boolean addProcureInquiry(StringBuffer publishSuin){
		
		procurepdao.saveProcureInquiry(publishSuin);
		
		return true;
	}
	
	/**
	 * 修改采购需求
	 */
	public boolean mergeprocureProduct(ProcureProduct procureProduct){
		
		procurepdao.merge(procureProduct);
		
		return true;
	}
	
}
